$(document).ready(function(){
	//修改邮箱地址
	$(".dhemail_url").bind("click",verify_dhemail);
	//用户信息修改-提交
	$(".edit_dhuser").bind("click",edit_dhuser);
	//直聘账号注册提交
	$(".dhuser_register").bind("click",dhuser_register);
	//直聘账号注册-提交基本信息
	$(".dhregister_info").bind("click",dhregister_info);
	//发送验证码
	$(".dh_sendphonecode").bind("click",dh_sendphonecode);
	//找回密码
	$(".dhuser_findpwd").bind("click",dhuser_findpwd);
	//选择招聘职位
	$("#dh_funtype li").bind("click",change_dhfunctype);
	//确定按钮click
	$(".savefunc").click(function(){
		save_func();
	});
	//选择行业
	$("#dh_indtype li").bind("click",change_dhindtype);
	
})

//用户信息修改-提交
function edit_dhuser()
{
	//解决频繁点击按钮，导致多次提交问题
	$(".edit_dhuser").unbind('click');
	$(".edit_dhuser").addClass("anniu_reg_gray").removeClass("anniu_reg");
	var email = $("input[name='hid_email']").val();
	var name = $("input[name='name']").val();
	var coname = $("input[name='coname']").val();
	var indtype = $("input[name='indtype']").val();
	var position = $("input[name='position']").val();
	var functype = $("input[name='functype']").val();
	if(email == "" || email == undefined || email == null){
		pop('请先绑定您的邮箱！',1,'确定','','popclose()');
		dhuser_click();
		return false;
	}
	//姓名长度验证
	name = name.replace(/^[\s]+|[\s]+$/g,"");
	if(name != ''){
		var nameLen = name.replace(/[^\x00-\xff]/g,"**").length;
		if(nameLen > 40){
			pop('姓名信息过长！',1,'确定','','popclose()');
			dhuser_click();
			return false;
		}
	}
	//公司名称长度验证
	coname = coname.replace(/^[\s]+|[\s]+$/g,"");
	if(coname != ''){
		var conameLen = coname.replace(/[^\x00-\xff]/g,"**").length;
		if(conameLen > 100){
			pop('公司名称信息过长！',1,'确定','','popclose()');
			dhuser_click();
			return false;
		}
	}
	//担任职务长度验证
	position = position.replace(/^[\s]+|[\s]+$/g,"");
	if(position != ''){
		var positionLen = position.replace(/[^\x00-\xff]/g,"**").length;
		if(positionLen > 40){
			pop('担任职务信息过长！',1,'确定','','popclose()');
			dhuser_click();
			return false;
		}
	}

	var url = '../ajax/dhuser/edit_user.ajax.php';
	var param = {'name':name,
	             'coname':coname,
				 'indtype':indtype,
				 'position':position,
				 'functype':functype,
				 'type':2
				 };
	var result = $.ajax({
		url:url,
		asyn:false,
		dataType:'json',
		type:'post',
		data:param,
		timeout:60000, //ajax请求超时60s
		success:function(result){
			if(result.status == 1){
				pop('用户信息修改成功！',1,'确定','','dhuser_url()');
			}else{
				pop(result.desc,1,'确定','','popclose()');
				return false;
			}
		},
		error:function(){ 
			pop("请求超时，请重新提交信息！",1,'确定','','popclose()');
		},
		complete:function(){
			dhuser_click();
		}
	});
	
}
//用户信息修改-提交按钮绑定click事件
function dhuser_click()
{
	$(".edit_dhuser").bind("click",edit_dhuser);
	$(".edit_dhuser").addClass("anniu_reg").removeClass("anniu_reg_gray");
}
//用户信息修改-提交成功跳转
function dhuser_url()
{
	window.location.href="../job/menu.php";
}

//验证邮箱
function verify_dhemail()
{
	//解决频繁点击按钮，导致多次提交问题
	$(".dhemail_url").unbind('click');
	$(".dhemail_url").addClass("anniu_reg_gray").removeClass("anniu_reg");
	var source_page = $("input[name='source_page']").val();
	var email = $("input[name='email']").val();
	var old_email = $("input[name='hid_email']").val();
	if('请输入您的邮箱' == email || email == ""){
		pop('请输入您的邮箱',1,'确定','','popclose()');
		verify_click();
		return false;
	}else{
		//去除前后空格和逗号
		email = email.replace(/^[\s]+|[\s]+$/g,"").replace(/^[,]+|[,]+$/g,"");
		if(email.indexOf(";") >= 0){
			pop('请输入有效的Email地址！',1,'确定','','popclose()');
			verify_click();
			return false;
		}
		//判断邮箱长度
		var emailLen = email.replace(/[^\x00-\xff]/g,"**").length;
		if(emailLen > 80){
			pop('Email地址过长！',1,'确定','','popclose()');
			verify_click();
			return false;
		}
		var emailSplit = email.split(',');
		//最多可输入一个邮箱
		if(emailSplit.length > 1){
			pop('只能输入一个Email！',1,'确定','','popclose()');
			verify_click();
			return false;
		}
		for(var i=0;i<emailSplit.length;i++){
			var myreg =/^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*))@([A-Za-z0-9]+[-A-Za-z0-9_]*\.)+[A-Za-z]{2,}$/;
			if(!myreg.test(emailSplit[i])){
				pop('对不起，您的邮箱格式错误！',1,'确定','','popclose()');
				verify_click();
				return false;
			}
		}
	}
	var url = '../ajax/dhuser/edit_dhemail.ajax.php';
	var param = {'email':email,
				 'old_email':old_email,
				 'source_page':source_page};
	var result = $.ajax({
		url:url,
		asyn:false,
		dataType:'json',
		type:'post',
		data:param,
		timeout:60000, //ajax请求超时60s
		success:function(result){
			if(result.status == 1){
				if(source_page == 'dhregister_mail'){
					pop('发送认证链接成功！请完善注册用户基本信息。',1,'确定','','verify_url()');
				}else{
					pop('发送认证链接成功！',1,'确定','','verify_url()');
				}
			}else if(result.status == 2){
				pop('邮箱已通过认证！',1,'确定','','verify_url()');
			}else{
				pop(result.desc,1,'确定','','popclose()');
				return false;
			}
		},
		error:function(){ 
			pop("请求超时，请重新发送认证链接！",1,'确定','','popclose()');
		},
		complete:function(){
			verify_click();
		}
	});
	
}
//绑定click事件
function verify_click()
{
	$(".dhemail_url").bind("click",verify_dhemail);
	$(".dhemail_url").addClass("anniu_reg").removeClass("anniu_reg_gray");
}

//验证链接发送成功后跳转
function verify_url()
{
	var source_page = $("input[name='source_page']").val();
	if(source_page == 'edit_dhemail'){
		window.location.href="../job/menu.php";
	}else if(source_page == 'dhregister_mail'){
		window.location.href="../dhuser/dhregister_info.php";
	}
}

//网才直聘账号-用户信息修改email未绑定弹窗
function showDiv()
{
	$("#bg").css({display: "block"});
    var $box = $('#dhuser_emaildiv');
	$box.css({
		//设置弹出层距离左边的位置
		left:($("body").width() - 300) / 2 + "px",
		//设置弹出层距离上面的位置
		top:($(window).height() - 250) / 2 + "px",
		display: "block"
	});
}
//关闭浮层
function closeDiv()
{
	$("#bg,#dhuser_emaildiv").css("display", "none");
}
//用户信息修改绑定email提交
function check_dhemail()
{
	var email = $("#dhemail").val();
	if('请输入您的常用邮箱' == email || email == ""){
		pop('请输入您的常用邮箱',1,'确定','','popclose()');
		return false;
	}else{
		//去除前后空格和逗号
		email = email.replace(/^[\s]+|[\s]+$/g,"").replace(/^[,]+|[,]+$/g,"");
		if(email.indexOf(";") >= 0){
			pop('请输入有效的Email地址！',1,'确定','','popclose()');
			return false;
		}
		//判断邮箱长度
		var emailLen = email.replace(/[^\x00-\xff]/g,"**").length;
		if(emailLen > 80){
			pop('Email地址过长！',1,'确定','','popclose()');
			return false;
		}
		var emailSplit = email.split(',');
		//最多可输入一个邮箱
		if(emailSplit.length > 1){
			pop('只能输入一个Email！',1,'确定','','popclose()');
			return false;
		}
		for(var i=0;i<emailSplit.length;i++){
			var myreg =/^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*))@([A-Za-z0-9]+[-A-Za-z0-9_]*\.)+[A-Za-z]{2,}$/;
			if(!myreg.test(emailSplit[i])){
				pop('对不起，您的邮箱格式错误！',1,'确定','','popclose()');
				return false;
			}
		}
	}
	var url = '../ajax/dhuser/edit_user.ajax.php';
	var param = {'email':email,'type':1};
	var result = $.ajax({
		url:url,
		asyn:false,
		dataType:'json',
		type:'post',
		data:param,
		success:function(result){
			if(result.status == 1){
				$("input[name='hid_email']").val(result.email);
				pop('邮箱绑定成功！',1,'确定','','dhemail_url()');
			}else{
				pop(result.desc,1,'确定','','popclose()');
				return false;
			}
		}
	});
}
//用户信息修改-绑定成功后跳转
function dhemail_url()
{
	var email = $("input[name='hid_email']").val();
	window.location.href ='edit_dhuser.php?email='+email+'';
	closeDiv();
}
//用户信息修改-未验证邮箱跳转
function edit_email()
{
	$("#dhuser_frm").submit();
}
//直聘账号注册发送验证码
function dh_sendphonecode(){
	//解决频繁点击按钮，导致多次提交问题
	$(".dh_sendphonecode").unbind('click');
	if($('#timeBut').hasClass('anfsyzm_gray')){
		sendphonecode_click();
		return;
	}
	var telphone = $('#telphone').val();
	var src = $('#src').val();
	if('请输入手机号' == telphone || '' == telphone){
		pop('请输入手机号',1,'确定','','popclose()');
		sendphonecode_click();
		return false;
	}
	if(!telphone.match(/^1[34578]{1,1}[0-9]{9,9}$/)){
		pop('请输入正确手机号',1,'确定','','popclose()');
		sendphonecode_click();
		return false;
	}
	var param = {'telphone':telphone,'src':src}
	var result = $.ajax({
		url:'../ajax/dhuser/dh_sendphonecode.ajax.php',
		asyn:false,
		dataType:'json',
		type:'post',
		data:param,
		timeout:60000, //ajax请求超时60s
		success:function(result){
			if(result.status == 1){
				pop("验证码已发送到您的手机！",1,'确定','','popclose()');
				$('#timeBut').html('60秒后重新发送');
				$('#timeBut').addClass('anfsyzm_gray');
				timeClock('timeBut');
				return true;
			}else{
				pop(result.desc,1,'确定','','popclose()');
			}
		},
		error:function(){ 
			pop("请求超时，请重新获取验证码！",1,'确定','','popclose()');
		},
		complete:function(){
			sendphonecode_click();
		}
	});
}
//注册发送验证码绑定click事件
function sendphonecode_click()
{
	$(".dh_sendphonecode").bind("click",dh_sendphonecode);
}

//直聘账号注册提交
function dhuser_register()
{
	//解决频繁点击按钮，导致多次提交问题
	$(".dhuser_register").unbind('click');
	$(".dhuser_register").addClass("anniu_reg_gray").removeClass("anniu_reg");
	var telephone 		  = $('#telphone').val(),
		verification_code = $('#verification_code').val(),
		regpwd			  = $('#regpwd').val();
	//过滤前后空格
	telephone = telephone.replace(/^[\s]+|[\s]+$/g,"");
	verification_code = verification_code.replace(/^[\s]+|[\s]+$/g,"");
	regpwd = regpwd.replace(/^[\s]+|[\s]+$/g,"");
	
	if('请输入手机号' == telephone || '' == telephone){
		pop('请输入手机号',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	if(!telephone.match(/^1[34578]{1,1}[0-9]{9,9}$/)){
		pop('请输入正确手机号',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	if('请输入验证码' == verification_code || '' == verification_code){
		pop('请输入验证码',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	if(!/^\d{6}$/.test(verification_code)){
		pop('请输入正确验证码',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	if('6-12位字母加数字' == regpwd || '' == regpwd){
		pop('请输入密码',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	if(regpwd.length<6 || regpwd.length>12){
		pop('密码必须在6～12位之间！',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	if(regpwd.match(/^[0-9]*[1-9][0-9]*$/) || regpwd.match(/^[A-Za-z]+$/) || !regpwd.match(/^[A-Za-z0-9]+$/)){
		pop('密码由字母加数字组成！',1,'确定','','popclose()');
		dhuser_register_click();
		return false;
	}
	var url = '../ajax/dhuser/dhregister.ajax.php';
	var param = {'regpwd':regpwd,
				 'verification_code':verification_code,
				 'telephone':telephone};
	var result = $.ajax({
		url:url,
		asyn:false,
		dataType:'json',
		type:'post',
		data:param,
		timeout:60000, //ajax请求超时60s
		success:function(result){
			if(result.status == 1){
				$("#accesstoken").val(result.accesstoken);
				$("#phone").val(telephone);
				pop("注册信息提交成功，请完善Email！",1,'确定','','dhRegister_submit()');
				return true;
			}else{
				pop(result.desc,1,'确定','','popclose()');
				return false;
			}
		},
		error:function(){ 
			pop("请求超时，请重新提交信息！",1,'确定','','popclose()');
		},
		complete:function(){
			dhuser_register_click();
		}
	});
}
//注册提交完成完善Email跳转
function dhRegister_submit(){
	$("#dhfrm").submit();
}
//注册账号提交绑定click事件
function dhuser_register_click()
{
	//解决频繁点击按钮，导致多次提交问题
	$(".dhuser_register").bind("click",dhuser_register);
	$(".dhuser_register").addClass("anniu_reg").removeClass("anniu_reg_gray");
}

//直聘账号注册-提交基本信息
function dhregister_info()
{
	//解决频繁点击按钮，导致多次提交问题
	$(".dhregister_info").unbind('click');
	$(".dhregister_info").addClass("anniu_reg_gray").removeClass("anniu_reg");
	var name     = $("input[name='name']").val();
	var coname   = $("input[name='coname']").val();
	var indtype  = $("input[name='indtype']").val();
	var position = $("input[name='position']").val();
	var functype = $("input[name='functype']").val();
	//姓名长度验证
	name = name.replace(/^[\s]+|[\s]+$/g,"");
	if(name != '' && name != '请输入您的真实姓名'){
		var nameLen = name.replace(/[^\x00-\xff]/g,"**").length;
		if(nameLen > 40){
			pop('姓名信息过长！',1,'确定','','popclose()');
			dhregister_click();
			return false;
		}
	}
	//公司名称长度验证
	coname = coname.replace(/^[\s]+|[\s]+$/g,"");
	if(coname != '' && coname != '请输入您的公司名称'){
		var conameLen = coname.replace(/[^\x00-\xff]/g,"**").length;
		if(conameLen > 100){
			pop('公司名称信息过长！',1,'确定','','popclose()');
			dhregister_click();
			return false;
		}
	}
	//担任职务长度验证
	position = position.replace(/^[\s]+|[\s]+$/g,"");
	if(position != '' && position != '请输入您的职位'){
		var positionLen = position.replace(/[^\x00-\xff]/g,"**").length;
		if(positionLen > 40){
			pop('担任职务信息过长！',1,'确定','','popclose()');
			dhregister_click();
			return false;
		}
	}
	if((name == "" || name == "请输入您的真实姓名") && (coname == "" || coname == "请输入您的公司名称") && (indtype == "" || indtype == "请选择行业") && (position == "" || position == "请输入您的职位") && (functype == "" || functype == "请选择招聘职位")){
		//若所有信息都未填写，给出提示后直接跳转，不经过接口
		pop('恭喜您注册成功！',1,'确定','','dhregister_url()');
		dhregister_click();
	}else{
		var url = '../ajax/dhuser/edit_user.ajax.php';
		var param = {'name':name,
					 'coname':coname,
					 'indtype':indtype,
					 'position':position,
					 'functype':functype,
					 'type':2
					 };
		var result = $.ajax({
			url:url,
			asyn:false,
			dataType:'json',
			type:'post',
			data:param,
			timeout:60000, //ajax请求超时60s
			success:function(result){
				if(result.status == 1){
					pop('恭喜您注册成功！',1,'确定','','dhregister_url()');
				}else{
					pop(result.desc,1,'确定','','popclose()');
					return false;
				}
			},
			error:function(){ 
				pop("请求超时，请重新提交信息！",1,'确定','','popclose()');
			},
			complete:function(){
				dhregister_click();
			}
		});	
	}	
}
//注册填写基本信息页绑定click事件
function dhregister_click()
{
	$(".dhregister_info").bind("click",dhregister_info);
	$(".dhregister_info").addClass("anniu_reg").removeClass("anniu_reg_gray");
}

//注册成功页面跳转
function dhregister_url()
{
	window.location.href = '../index.php';
}

//找回密码-完成
function dhuser_findpwd()
{
	//解决频繁点击按钮，导致多次提交问题
	$(".dhuser_findpwd").unbind('click');
	$(".dhuser_findpwd").addClass("anniu_reg_gray").removeClass("anniu_reg");
	var telephone 		  = $('#telphone').val(),
		verification_code = $('#verification_code').val(),
		regpwd			  = $('#regpwd').val();
	//过滤前后空格
	telephone = telephone.replace(/^[\s]+|[\s]+$/g,"");
	verification_code = verification_code.replace(/^[\s]+|[\s]+$/g,"");
	regpwd = regpwd.replace(/^[\s]+|[\s]+$/g,"");
	if('请输入手机号' == telephone || '' == telephone){
		pop('请输入手机号',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	if(!telephone.match(/^1[34578]{1,1}[0-9]{9,9}$/)){
		pop('请输入正确手机号',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	if('请输入验证码' == verification_code || '' == verification_code){
		pop('请输入验证码',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	if(!/^\d{6}$/.test(verification_code)){
		pop('请输入正确验证码',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	if('6-12位字母加数字' == regpwd || '' == regpwd){
		pop('请输入新密码',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	if(regpwd.length<6 || regpwd.length>12){
		pop('密码必须在6～12位之间！',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	if(regpwd.match(/^[0-9]*[1-9][0-9]*$/) || regpwd.match(/^[A-Za-z]+$/) || !regpwd.match(/^[A-Za-z0-9]+$/)){
		pop('密码由字母加数字组成！',1,'确定','','popclose()');
		dhuser_findpwd_click();
		return false;
	}
	var url = '../ajax/dhuser/dhfindpwd.ajax.php';
	var param = {'regpwd':regpwd,
				 'verification_code':verification_code,
				 'telephone':telephone};
	var result = $.ajax({
		url:url,
		asyn:false,
		dataType:'json',
		type:'post',
		data:param,
		timeout:60000, //ajax请求超时60s
		success:function(result){
			if(result.status == 1){
				pop('密码修改成功！',1,'确定','','dhfindpwd_url()');
			}else{
				pop(result.desc,1,'确定','','popclose()');
				return false;
			}
		},
		error:function(){ 
			pop("请求超时，请重新提交信息！",1,'确定','','popclose()');
		},
		complete:function(){
			dhuser_findpwd_click();
		}
	});
}
//找回密码-完成绑定click事件
function dhuser_findpwd_click()
{
	$(".dhuser_findpwd").bind("click",dhuser_findpwd);
	$(".dhuser_findpwd").addClass("anniu_reg").removeClass("anniu_reg_gray");
}

//找回密码成功后跳转到登陆页
function dhfindpwd_url()
{
	var back_login_url = $("input[name='back_login_url']").val();
	window.location.href = back_login_url;
}
//选择招聘职位
function dh_chooseFuntype(){
	$("#dh_funtype p").removeClass("show");
	$("#dh_funtype ul").css('display','none');
	$("#dh_funtype li[selected='1']").parent().prev().addClass("show");
	$("#dh_funtype li[selected='1']").parent().css("display","block");
	//最新职能
	var functype = $("input[name='functype']").val();
	var functypestr = $("input[name='functypestr']").val();
	//当前选择职能
	var curve_functype = $("input[name='curve_functype']").val();
	//先清除掉当前选择职能
	var curve_functypeCat;
	if(curve_functype != ''){
		var curve_functype_split = curve_functype.split(',');
		for(var i=0;i<curve_functype_split.length;i++){
			$("#dh_funtype li[code='"+curve_functype_split[i]+"']").removeClass('check_mark');
			$("#dh_funtype li[code='"+curve_functype_split[i]+"']").attr('selected',0);
			//隐藏职能大类
			curve_functypeCat = curve_functype_split[i].substr(0,2)+'00';
			$("#dh_funtype p[name='funtype_"+curve_functypeCat+"']").removeClass('show');
			document.getElementById("funtype_"+curve_functypeCat+"").style.display = 'none';
		}
	}
	//确定后的最新职能打对钩处于选中状态
	var functypeCat;
	if(functype != ''){
		var functype_split = functype.split(',');
		for(var j=0;j<functype_split.length;j++){
			$("#dh_funtype li[code='"+functype_split[j]+"']").addClass('check_mark');
			$("#dh_funtype li[code='"+functype_split[j]+"']").attr('selected',1);
			//选中状态下职能大类展示
			functypeCat = functype_split[j].substr(0,2)+'00';
			$("#dh_funtype p[name='funtype_"+functypeCat+"']").addClass('show');
			document.getElementById("funtype_"+functypeCat+"").style.display = 'block';
		}
	}
	
	//为当前选择职能赋值
	$("input[name='curve_functype']").val(functype);
	$("input[name='curve_functypestr']").val(functypestr);
	if(functype != ''){
		$("input[name='func_num']").val(functype_split.length);
	}else{
		$("input[name='func_num']").val('0');
	}
	
	pLoad('dh_funtype',this);
}
//选中招聘职位
function change_dhfunctype()
{
	//职位个数
	var func_num = $("input[name='func_num']").val();
	//职能code
	var functype = $("input[name='curve_functype']").val();
	//职能
	var functypestr = $("input[name='curve_functypestr']").val();
	var total = "";
	total = parseInt(func_num);
	if($(this).hasClass('check_mark')){
		var del_functypeCoid = $(this).attr("code");
		var del_functypeName = $(this).html();
		//去除职能code
		var functypeCoid_split = functype.split(",");//以逗号作为分隔字符串
		var functype_coid = "";
		for(i=0;i<functypeCoid_split.length;i++){
			if(functypeCoid_split[i] != del_functypeCoid){
				functype_coid += functypeCoid_split[i]+',';
			}
		}
		functype_coid = functype_coid.substring(0,functype_coid.length-1);
		//去除职能
		var functypeName_split = functypestr.split(",");
		var functype_name = "";
		for(i=0;i<functypeName_split.length;i++){
			if(functypeName_split[i] != del_functypeName){
				functype_name += functypeName_split[i]+',';
			}
		}
		functype_name = functype_name.substring(0,functype_name.length-1);
		
		//去除样式
		$(this).removeClass('check_mark');
		$(this).attr('selected',0);
		total--;
		//赋值
		$("input[name='curve_functype']").val(functype_coid);
		$("input[name='curve_functypestr']").val(functype_name);
		$("input[name='func_num']").val(total);
	}else{
		if(total >= 10){
			pop('招聘职位最多可选择10个！',1,'确定','','popclose()');
			return false;
		}
		var newFunctypeName = $(this).html();
		var functypeCoid = $(this).attr("code");
		//追加新增的职能code
		if(functype != "" && functype !== undefined && functype !== null){
			var newFunctypeCoid = functypeCoid+','+functype;
		}else{
			var newFunctypeCoid = functypeCoid;
		}
		//追加新增的职能
		if(functypestr != "" && functypestr !== undefined && functypestr !== null){
			var newFunctypeNameStr = newFunctypeName+','+functypestr;
		}else{
			var newFunctypeNameStr = newFunctypeName;
		}
		//增加样式
		$(this).addClass('check_mark');
		$(this).attr('selected',1);
		total++;
		//赋值
		$("input[name='curve_functype']").val(newFunctypeCoid);
		$("input[name='curve_functypestr']").val(newFunctypeNameStr);
		$("input[name='func_num']").val(total);
	}
}

//选择招聘职位-确定
function save_func()
{
	var curve_functype = $("input[name='curve_functype']").val();
	var curve_functypestr = $("input[name='curve_functypestr']").val();
	//赋值
	if(curve_functypestr != ''){
		$(".show_functype").html(curve_functypestr);
	}else{
		$(".show_functype").html('请选择招聘职位');
	}
	$("input[name='functype']").val(curve_functype);
	$("input[name='functypestr']").val(curve_functypestr);
	
	$(".savefunc").parents('.pgbox').find('.back').trigger('click');
	setScrollTop();
}
//选择行业
function dh_chooseIndtype()
{
	$("#dh_indtype ul").css('display','block');
	$("#dh_indtype li[selected='1']").parent().prev().addClass("show");
	$("#dh_indtype li[selected='1']").parent().css("display","block");
	pLoad('dh_indtype',this);
}
//选择行业
function change_dhindtype()
{
	//行业code
	var indtype = $("input[name='indtype']").val();
	//行业
	var indtypename = $("input[name='indtypename']").val();
	var newIndtypeName = $(this).html();
	var indtypeCoid = $(this).attr("code");
	if ( indtype != '' ){
		$("#dh_indtype li[selected='1']").removeClass('check_mark');
		$("#dh_indtype li[selected='1']").attr('selected',0);
	}
	$(this).addClass('check_mark');
	$(this).attr('selected',1);
	//赋值
	$(".show_indtype").html(newIndtypeName);
	$("input[name='indtype']").val(indtypeCoid);
	$("input[name='indtypename']").val(newIndtypeName);
	//返回上一级
	hidden_div();
}
//选择行业、招聘职位返回上一级隐藏层
function hidden_div(){
	$('#dh_indtype').css('z-index','7').hide();
	$('#pop').hide();
	$('#shadow').hide();
	$('#mainPage').show();
	setScrollTop();
}

